package com.oa.lms.apps.actions.absence;

import java.text.ParseException;
import java.util.List;

import com.oa.lms.apps.actions.BasicAction;
import com.oa.lms.apps.business.absence.IAbsenceOrderService;
import com.oa.lms.apps.business.absence.IReplyOrderService;
import com.oa.lms.apps.business.user.IUserInfoService;
import com.oa.lms.apps.business.user.IUsersService;
import com.oa.lms.apps.entity.absence.AbsenceOrderValue;
import com.oa.lms.apps.entity.absence.ReplyOrderValue;
import com.oa.lms.apps.entity.user.UsersValue;

@SuppressWarnings("serial")
public class ReplyOrderAction extends BasicAction {
	
	private IUsersService usersService;
	private IReplyOrderService replyOrderService;
	private IAbsenceOrderService absenceOrderService;
	private IUserInfoService userInfoService;
	private AbsenceOrderValue orderInfo;
	private UsersValue userInfo;
	
	private List<AbsenceOrderValue> absenceOrderList;
	private List<ReplyOrderValue> replyOrderList;
	
	private String replyId;
	private String orderId;
	private String agreeOrNot;
	private String contents;
	private String createTime;
	private String userId;

	

	public String addReplyOrder() throws ParseException{
		userInfo = (UsersValue) session.get("login_userInfo");
		int agreeOrNot =Integer.parseInt(this.agreeOrNot);
		int orderId = Integer.parseInt(this.orderId);
		replyOrderService.add(agreeOrNot,contents,orderId,userInfo.getUserId());
		if (agreeOrNot==1){
			absenceOrderService.nextCheck(orderId);
		}
		if (agreeOrNot==0){
			absenceOrderService.toFail(orderId);
		}
		return SUCCESS;
	}
	public String toAdd(){
		orderInfo = absenceOrderService.queryByOrderId(Integer.parseInt(orderId));
		return SUCCESS;
	}

//Getter and Setter
	public IUsersService getUsersService() {
		return usersService;
	}


	public void setUsersService(IUsersService usersService) {
		this.usersService = usersService;
	}


	public IReplyOrderService getReplyOrderService() {
		return replyOrderService;
	}


	public void setReplyOrderService(IReplyOrderService replyOrderService) {
		this.replyOrderService = replyOrderService;
	}


	public IAbsenceOrderService getAbsenceOrderService() {
		return absenceOrderService;
	}


	public void setAbsenceOrderService(IAbsenceOrderService absenceOrderService) {
		this.absenceOrderService = absenceOrderService;
	}


	public IUserInfoService getUserInfoService() {
		return userInfoService;
	}


	public void setUserInfoService(IUserInfoService userInfoService) {
		this.userInfoService = userInfoService;
	}


	public AbsenceOrderValue getOrderInfo() {
		return orderInfo;
	}


	public void setOrderInfo(AbsenceOrderValue orderInfo) {
		this.orderInfo = orderInfo;
	}




	public List<AbsenceOrderValue> getAbsenceOrderList() {
		return absenceOrderList;
	}


	public void setAbsenceOrderList(List<AbsenceOrderValue> absenceOrderList) {
		this.absenceOrderList = absenceOrderList;
	}


	public List<ReplyOrderValue> getReplyOrderList() {
		return replyOrderList;
	}


	public void setReplyOrderList(List<ReplyOrderValue> replyOrderList) {
		this.replyOrderList = replyOrderList;
	}


	public String getReplyId() {
		return replyId;
	}


	public void setReplyId(String replyId) {
		this.replyId = replyId;
	}


	public String getOrderId() {
		return orderId;
	}


	public void setOrderId(String orderId) {
		this.orderId = orderId;
	}


	public String getAgreeOrNot() {
		return agreeOrNot;
	}


	public void setAgreeOrNot(String agreeOrNot) {
		this.agreeOrNot = agreeOrNot;
	}


	public String getContents() {
		return contents;
	}


	public void setContents(String contents) {
		this.contents = contents;
	}


	public String getCreateTime() {
		return createTime;
	}


	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}


	public String getUserId() {
		return userId;
	}


	public void setUserId(String userId) {
		this.userId = userId;
	}
	public UsersValue getUserInfo() {
		return userInfo;
	}
	public void setUserInfo(UsersValue userInfo) {
		this.userInfo = userInfo;
	}

	
}
